//
//  DynamicTwoCollectionViewCell.m
//  MJApp
//
//  Created by wangliang on 15/5/27.
//  Copyright (c) 2015年 wangliang. All rights reserved.
//

#import "DynamicTwoCollectionViewCell.h"

@interface DynamicTwoCollectionViewCell ()

@property (weak, nonatomic) IBOutlet UIButton *oneBtn;
@property (weak, nonatomic) IBOutlet UIButton *twoBtn;
@property (weak, nonatomic) IBOutlet UIButton *threeBtn;
@property (weak, nonatomic) IBOutlet UIButton *fourBtn;

@property (strong, nonatomic) IBOutletCollection(UIButton) NSArray *btnS;


@end

@implementation DynamicTwoCollectionViewCell

- (void)awakeFromNib {
    // Initialization code
    
    self.layer.borderColor = [UIColor lightGrayColor].CGColor;
    self.layer.borderWidth = 0.5;
}

- (void)setInfoArr:(NSArray *)infoArr {
    
    _infoArr = infoArr;
    for (int i = 0; i < infoArr.count; i ++) {
        NSDictionary *dic = infoArr[i];
        UIButton *btn = self.btnS[i];
        NSString *btnStr = [NSString stringWithFormat:@"#%@#",dic[@"title"]];
        [btn setTitle:btnStr forState:UIControlStateNormal];
    }
}

- (IBAction)buttonAction:(id)sender {
    
    UIButton *btn = sender;
    NSInteger index = [self.btnS indexOfObject:btn];
    if ([self.delegate respondsToSelector:@selector(homeCell:withInfo:)]) {
        
        [self.delegate homeCell:self withInfo:self.infoArr[index]];
    }
}

@end
